describe('Testing User', function() {
    var httpBackend;

    // registering module configuration
    beforeEach(module('MyApp'));

    // injecting the current scope
    // with services from prividers
    beforeEach(inject(function($httpBackend){
        httpBackend = $httpBackend;
    }));

    // checking for non executed http requests
    // after each execution of it (...)
    afterEach(function(){
        // if there is expected http request defined
        // via httpBackend.expect(...) method which request
        // is not executed it will throw an exception
        httpBackend.verifyNoOutstandingExpectation();
        httpBackend.verifyNoOutstandingRequest();
    })

    // injecting the test function scope
    // here ve have access to all stuff declared
    // in the module
    it ('testing users all', inject(function(users){
        // setting up the httpBackend
        // to respond with certain response
        // to a certain request
        httpBackend
            .when('GET', '/comverse/users/all')
            .respond({"result":{
                "545aad7be09f7":{
                    "name":"Test Test",
                    "password":"test",
                    "email":"test@example.com",
                    "sex":"male",
                    "age":30,
                    "id":"545aad7be09f7"
                },
                "545aaf144d2d3":{
                    "name":"Test Test",
                    "password":"test",
                    "email":"test@example.com",
                    "sex":"male",
                    "age":30,
                    "id":"545aaf144d2d3"
                }
            }});
        expect(typeof users.all).toEqual('function');

        var promise = users.all();
        var result
        promise.then(function(data){
            result = data;
        })

        httpBackend.flush();

        expect(typeof result).toBe('object');
    }));
});